﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
using System.ComponentModel;

namespace ProjectA.Controls
{
    public class cLabel : Label
    {
        public cLabel(Point pPoint, Size sSize, string sText)
        {
            Location = pPoint;
            Size = sSize;
            Design(new Font("Arial", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))), Color.FromArgb(((int)(((byte)(75)))), ((int)(((byte)(117)))), ((int)(((byte)(154))))),ContentAlignment.TopLeft, sText);
        }

        public cLabel(Point pPoint, Size sSize, Font fFont, Color? fcColor, ContentAlignment? align, string sText)
        {
            Location = pPoint;
            Size = sSize;
            Design(fFont, fcColor,align, sText);
        }

        private void Design(Font fFont, Color? fcColor,ContentAlignment? align, string sText)
        {
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);
            Margin = new System.Windows.Forms.Padding(0);
            BackColor = Color.Transparent;
            TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            if (fFont != null)
                Font = fFont;
            if (fcColor != null)
                ForeColor = (Color)fcColor;
            Text = sText;
            if (align != null)
                TextAlign = (ContentAlignment) align;
        }

        [Browsable(false)]
        protected override CreateParams CreateParams
        {
            get
            {
                CreateParams cp = base.CreateParams;
                cp.ExStyle |= 0x20;
                return cp;
            }
        }
    }
}
